local skel = fk.CreateSkill {
  name = "lb_zero__jianyi",
}

Fk:loadTranslationTable {
  ["lb_zero__jianyi"] = "剑仪",
  --[":lb_zero__jianyi"] = "你每失去三次牌后可摸或使用一张不计入次数的牌。",
  --[":lb_zero__jianyi"] = "你每失去三次牌后可摸一张不计入手牌上限的牌。",
  [":lb_zero__jianyi"] = "你每失去三次手牌后可摸一张不计入手牌上限的牌。",

  ["#lb_zero__jianyi"] = "剑仪：你可以摸一张不计入手牌上限的牌",
  --["#lb_zero__jianyi"] = "剑仪：你可以摸或使用一张不计入次数的牌",
  --["#lb_zero__jianyi-ask"] = "剑仪：你可以使用一张牌，或取消后摸一张牌",

  ["@lb_zero__jianyi"] = "剑仪",
  ["@@lb_zero__jianyi-inhand"] = "剑仪",

  ["$lb_zero__jianyi1"] = "为你献上…最对称的华丽剑术！",
  ["$lb_zero__jianyi2"] = "休想逃走。",
}

skel:addEffect(fk.AfterCardsMove, {
  can_trigger = function (self, event, target, player, data)
    if player:hasSkill(skel.name, true) then
      for _, move in ipairs(data) do
        if move.from == player and table.find(move.moveInfo, function (info)
          return info.fromArea == Card.PlayerHand-- or info.fromArea == Card.PlayerEquip
        end) then
          player.room:addPlayerMark(player, "@lb_zero__jianyi")
          return player:hasSkill(skel.name) and player:getMark("@lb_zero__jianyi") % 3 == 0
        end
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, { skill_name = skel.name, prompt = "#lb_zero__jianyi"})
  end,
  on_use = function (self, event, target, player, data)
    player:drawCards(1, skel.name, nil,  "@@lb_zero__jianyi-inhand")
    --[[
    if not player.room:askToPlayCard(player, {
      skill_name = skel.name,
      cancelable = true,
      pattern = ".",
      prompt = "#lb_zero__jianyi-ask",
      extra_data = { extraUse = true }
    }) then
      player:drawCards(1, skel.name)
    end
    --]]
  end,
})


skel:addEffect("maxcards", {
  exclude_from = function (self, player, card)
    if card:getMark("@@lb_zero__jianyi-inhand") ~= 0 then
      return true
    end
  end
})
return skel
